package com.oauth.service.impl;

import com.oauth.mapper.OpenResourceAuthMapper;
import com.oauth.model.OpenResourceAuth;
import com.oauth.service.OpenResourceAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by yangjianbo on 2016/9/30.
 */
@Service
public class OpenResourceAuthServiceImpl implements OpenResourceAuthService {

    @Autowired
    private OpenResourceAuthMapper openResourceAuthMapper;

    @Override
    public List<OpenResourceAuth> select(String client_id) {

        OpenResourceAuth openResourceAuth=new OpenResourceAuth();
        openResourceAuth.setClientId(client_id);
        return openResourceAuthMapper.select(openResourceAuth);
    }

    @Override
    public OpenResourceAuth select(String client_id, String resource_id) {

        OpenResourceAuth openResourceAuth=new OpenResourceAuth();
        openResourceAuth.setClientId(client_id);
        openResourceAuth.setResourceId(resource_id);
        return openResourceAuthMapper.selectOne(openResourceAuth);
    }
}
